package com.lanyou.cook.camel.dao.impl;

import org.apache.log4j.Logger;

import com.lanyou.cook.camel.entity.AccessLog;

public class AccessLogDao extends BaseDao<AccessLog>{
	private static Logger logger = Logger.getLogger(AccessLogDao.class);
	@Override
	public int save(AccessLog accessLog) {
		// TODO 自动生成的方法存根
		/*String sql = "insert into T_ESB_BU_IF_FTP_LOG(id, if_id, if_name, sourceIp, targetIp, fileName, transportDate)"
				   + " values(?, ?, ?, ?, ?, ?)";*/
		
		String sql = "INSERT INTO t_esb_bu_if_ftp_log(ftp_log_id, if_ftp_id, source_address, target_address, file_name, file_size, transport_date, IS_ENABLE, CREATOR, CREATED_DATE, MODIFIER, LAST_UPDATED_DATE, TRANSPORT_RESULT, TRANSPORT_RESULT_DES,IF_NAME,FIELD_SYSTEM_ID,EXECUTE_TASK_NODE) VALUE(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?)";
		if(accessLog != null){
			logger.info("[AccessLogDao.save]:"+accessLog.getSourceIps()+"--"+accessLog.getFileName()+accessLog.getTargetIps());
	        return this.getJdbcTemplate().update(sql, 
	        		new Object[]{accessLog.getId(),
	        					 accessLog.getInterfaceId(), 
	        					 accessLog.getSourceIps(),
	        					 accessLog.getTargetIps(),
	        					 accessLog.getFileName(),
	        					 accessLog.getFileSize(),
	        					 accessLog.getTransportTime(),
	        					 accessLog.getIsEnable(),
	        					 accessLog.getCreator(),
	        					 accessLog.getCreatedDate(),
	        					 accessLog.getModifier(),
	        					 accessLog.getLastUpdatedDate(),
	        					 accessLog.getTransportResult(),
	        					 accessLog.getTransportResutlDes(),
	        					 accessLog.getInterfaceName(),
	        					 accessLog.getFieldSystemId(),
	        					 accessLog.getExecuteTaskNode()}); 
		}else{
			logger.info("[AccessLogDao.save]:unsave");
			return -1;
		}
	}
	
	
}
